package com.itmayiedu;

import com.spring4all.swagger.EnableSwagger2Doc;
import io.swagger.annotations.Api;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

/**
 * @description: 订单服务启动类
 * @EnableEurekaClient [将该服务注册到eureka注册中心]
 * @EnableFeignClients [开启Feign客户端的权限]
 * @EnableSwagger2Doc [服务开启swagger接口管理平台，无需编写swagger配置文件类]
 * @author: liucancan
 * @create: 2018-11-03 16:29
 **/
@SpringBootApplication
@EnableEurekaClient
@EnableFeignClients
@EnableSwagger2Doc
@Api("订单项目接口平台")
public class AppOrder {

    public static void main(String[] args) {
        SpringApplication.run(AppOrder.class, args);
    }

    // 注入RestTemplate
    @Bean
    // 这个RestTemplate在请求时拥有客户端负载均衡的能力
    // @LoadBalanced
    public RestTemplate getRestTemplate() {
        return new RestTemplate();
    }
}
